package com.settlement.system.service.impl;

import com.settlement.system.mapper.TblAcsPermissonOrderSourceMapper;
import com.settlement.system.model.entity.common.TblAcsPermissonOrderSource;
import com.settlement.system.service.ITblAcsPermissonOrderSourceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.settlement.system.mapper.BaseMapper;

import jakarta.annotation.Resource;
import java.util.List;

/**
 * 订单来源权限表 服务实现类
 * @author he.xx
 * @since 2021-07-08
 */
@Service
@Slf4j
public class TblAcsPermissonOrderSourceServiceImpl extends BaseServiceImpl implements ITblAcsPermissonOrderSourceService {

    @Resource
    private TblAcsPermissonOrderSourceMapper tblAcsPermissonOrderSourceMapper;

    @Override
    public BaseMapper init() {
        return tblAcsPermissonOrderSourceMapper;
    }

    @Override
    public void batchSave(List<TblAcsPermissonOrderSource> dataList) {
        tblAcsPermissonOrderSourceMapper.batchInsert(dataList);
    }

    @Override
    public List<TblAcsPermissonOrderSource> selectByModel(TblAcsPermissonOrderSource tblAcsPermissonOrderSource) {
        return tblAcsPermissonOrderSourceMapper.selectByModel(tblAcsPermissonOrderSource);
    }

    @Override
    public List<String> queryOrderSourcePermission(String userNo) {
        int num = tblAcsPermissonOrderSourceMapper.queryOrderSourcePermissionCount(userNo);
        if (num > 0) {
            List<String> orderSourcePermissionList = tblAcsPermissonOrderSourceMapper.queryOrderSourcePermission(userNo);
            return orderSourcePermissionList;
        }
        return null;
    }
}

